package userInterface;

import java.awt.Color;

public class Line extends DrawObject
{
	public Line(Point start, Point end, int thickness, Color color)
	{
		super(color);
		super.setShape(Shape.LINE);
		_startPoint = start;
		_endPoint = end;
		_thickness = thickness;
	}
	
	public Line(Line l)
	{
		super(l.getColor());
		super.setShape(Shape.LINE);
		_startPoint = new Point(l.getStartPoint().X, l.getStartPoint().Y);
		_endPoint = new Point(l.getEndPoint().X, l.getEndPoint().Y);
		_thickness = l.getThickness();
	}

	public int getThickness()
	{
		return _thickness;
	}
	
	public void setThickness(int thickness)
	{
		_thickness = thickness;
		for (DrawingModel m : _models)
			m.modelChanged();
	}
	
	public Point getStartPoint()
	{
		return _startPoint;
	}
	
	public void setStartPoint(Point start)
	{
		_startPoint = start;
		for (DrawingModel m : _models)
			m.modelChanged();
	}
	
	public Point getEndPoint()
	{
		return _endPoint;
	}
	
	public void setEndPoint(Point end)
	{
		_endPoint = end;
		for (DrawingModel m : _models)
			m.modelChanged();
	}
	
	@Override
	public void move(int x, int y)
	{
		_startPoint.X += x;
		_startPoint.Y += y;
		_endPoint.X += x;
		_endPoint.Y += y;
		for (DrawingModel m : _models)
			m.modelChanged();
	}

	private int _thickness;
	
	private Point _startPoint;
	
	private Point _endPoint;
}
